import lazyLoadView from '@/router/lazy-load';

import { AppRouteRecordRaw } from '../types';
import { DEFAULT_LAYOUT } from '../base';

const System: AppRouteRecordRaw = {
  path: '/system',
  name: 'System',
  component: DEFAULT_LAYOUT,
  meta: {
    locale: 'menu.system',
    requiresAuth: true,
    icon: 'icon-settings',
    order: 999,
    roleCode: 'GROUP_SYSTEM_ADMIN',
  },
  children: [
    {
      path: 'user',
      name: 'user',
      component: lazyLoadView(() => import('@/views/system/user/index.vue')),
      meta: {
        locale: 'menu.system.user',
        requiresAuth: true,
        order: 5,
        roleCode: 'GROUP_ACCOUNT',
        pageName: '账号列表',
      },
    },
    {
      path: 'user-detail',
      name: 'UserDetail',
      meta: {
        locale: 'menu.system.userDetail',
        requiresAuth: true,
        roleCode: 'GROUP_ACCOUNT',
        hideInMenu: true,
        layout: 'detail',
      },
      component: lazyLoadView(() => import('@/views/system/user/detail.vue')),
    },
    {
      path: 'role',
      name: 'role',
      component: lazyLoadView(() => import('@/views/system/role/index.vue')),
      meta: {
        locale: 'menu.system.role',
        requiresAuth: true,
        order: 5,
        roleCode: 'GROUP_ROLE',
        pageName: '角色列表',
      },
    },
    {
      path: 'menu',
      name: 'menu',
      component: lazyLoadView(() => import('@/views/system/menu/index.vue')),
      meta: {
        locale: 'menu.system.menu',
        requiresAuth: true,
        order: 5,
        roleCode: 'GROUP_MENU',
        pageName: '菜单列表',
      },
    },
    {
      path: 'dict',
      name: 'dict',
      component: lazyLoadView(() => import('@/views/system/dict/index.vue')),
      meta: {
        locale: 'menu.system.dict',
        requiresAuth: true,
        order: 5,
        roleCode: 'GROUP_DICT',
        pageName: '字典列表',
      },
    },
  ],
};

export default System;
